package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.ElevatorTiringMapper;
import com.gc.business.domain.ElevatorTiring;
import com.gc.business.service.IElevatorTiringService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 电梯困人管理 服务层实现
 * 
 * @author liujinteng
 * @date 2020-11-21
 */
@Slf4j
@Service
public class ElevatorTiringServiceImpl extends ServiceImpl<ElevatorTiringMapper, ElevatorTiring> implements IElevatorTiringService {


    @Autowired
    private ElevatorTiringMapper elevatorTiringMapper;

    @Override
    public List<ElevatorTiring> list(ElevatorTiring elevatorTiring){
        LambdaQueryWrapper<ElevatorTiring> wrapper = new LambdaQueryWrapper<>();
        if(elevatorTiring != null){
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringId())){
                wrapper.eq(ElevatorTiring::getTiringId, elevatorTiring.getTiringId());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getElevatorId())){
                wrapper.eq(ElevatorTiring::getElevatorId, elevatorTiring.getElevatorId());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getElevatorName())){
                wrapper.like(ElevatorTiring::getElevatorName, elevatorTiring.getElevatorName());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getReportMan())){
                wrapper.eq(ElevatorTiring::getReportMan, elevatorTiring.getReportMan());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringCode())){
                wrapper.eq(ElevatorTiring::getTiringCode, elevatorTiring.getTiringCode());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringFloor())){
                wrapper.eq(ElevatorTiring::getTiringFloor, elevatorTiring.getTiringFloor());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringType())){
                wrapper.eq(ElevatorTiring::getTiringType, elevatorTiring.getTiringType());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getReportTime())){
                wrapper.eq(ElevatorTiring::getReportTime, elevatorTiring.getReportTime());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getCompleteTime())){
                wrapper.eq(ElevatorTiring::getCompleteTime, elevatorTiring.getCompleteTime());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringDuration())){
                wrapper.eq(ElevatorTiring::getTiringDuration, elevatorTiring.getTiringDuration());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringState())){
                wrapper.eq(ElevatorTiring::getTiringState, elevatorTiring.getTiringState());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringCause())){
                wrapper.eq(ElevatorTiring::getTiringCause, elevatorTiring.getTiringCause());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getLongitudeStart())){
                wrapper.eq(ElevatorTiring::getLongitudeStart, elevatorTiring.getLongitudeStart());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getLatitudeStart())){
                wrapper.eq(ElevatorTiring::getLatitudeStart, elevatorTiring.getLatitudeStart());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getLongitudeEnd())){
                wrapper.eq(ElevatorTiring::getLongitudeEnd, elevatorTiring.getLongitudeEnd());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getLatitudeEnd())){
                wrapper.eq(ElevatorTiring::getLatitudeEnd, elevatorTiring.getLatitudeEnd());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getRescuePeople())){
                wrapper.like(ElevatorTiring::getRescuePeople, elevatorTiring.getRescuePeople());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getRescuePeopleSign())){
                wrapper.eq(ElevatorTiring::getRescuePeopleSign, elevatorTiring.getRescuePeopleSign());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getConfirmPeople())){
                wrapper.like(ElevatorTiring::getConfirmPeople, elevatorTiring.getConfirmPeople());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getConfirmPeopleSign())){
                wrapper.eq(ElevatorTiring::getConfirmPeopleSign, elevatorTiring.getConfirmPeopleSign());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getTiringDescribe())){
                wrapper.like(ElevatorTiring::getTiringDescribe, elevatorTiring.getTiringDescribe());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getIsApproved())){
                wrapper.eq(ElevatorTiring::getIsApproved, elevatorTiring.getIsApproved());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getRescueSign())){
                wrapper.eq(ElevatorTiring::getRescueSign, elevatorTiring.getRescueSign());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getCreateBy())){
                wrapper.eq(ElevatorTiring::getCreateBy, elevatorTiring.getCreateBy());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getCreateTime())){
                wrapper.eq(ElevatorTiring::getCreateTime, elevatorTiring.getCreateTime());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getUpdateBy())){
                wrapper.eq(ElevatorTiring::getUpdateBy, elevatorTiring.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getUpdateTime())){
                wrapper.eq(ElevatorTiring::getUpdateTime, elevatorTiring.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(elevatorTiring.getRemark())){
                wrapper.eq(ElevatorTiring::getRemark, elevatorTiring.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }

    @Override
    public List<ElevatorTiring> findMyRescueList(Long userId) {
        return elevatorTiringMapper.findMyRescueList(userId);
    }

    /**
     * 数据权限查询
     * @param elevatorTiring
     * @return
     */
    @Override
    public List<ElevatorTiring> selectElevatorTiringList(ElevatorTiring elevatorTiring){
        return baseMapper.selectElevatorTiringList(elevatorTiring);
    }
}
